# playlist.py - Jukee
#
# Copyright (C) 2008 Ruben Medellin <ruben.medellin.c@gmail.com>
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the
#    Free Software Foundation, Inc., 59 Temple Place, Suite 330,
#    Boston, MA  02111-1307  USA

"""Encapsulates all functions and properties of the distributed playlist"""

from jukee.utils.utils import warn

#################### Playlist ####################

class Playlist():
  """Contains a queue of songs and a pointer to the current playing song"""
  
  NO_SONG = -1

  def __init__(self):
    self.playlist = []
    self.current = Playlist.NO_SONG

  def add(song):
    pass

  def remove(song):
    pass

  def swap(song1, song2):
    pass

#################### Song ####################

class Song():
  """Represents a playable song, and holds extra attributes such as comments, votes, etc."""

  def __init__(self, id, meta):
    self.id = id
    self.meta = meta #TODO: Where should song metatags (i.e: ID3), should be grabbed? Client or server?
    name = self.meta.get('NAME', None)
    if name:
      self.name = name
    else:
      warn("Song without name")
      self.name = str(id)
    self.votes = 0
    self.comments = []
